{php include wl_template('common/header');}
<style>
	td>i{cursor:pointer; display:inline-block; width:100%; height:100%; color:#428bca;}
	.category-caret{display:inline-block; width:20px; margin: 0 10px; text-align:center; cursor:pointer; color:#d9534f;}
	.scrollLoading{border-radius: 50px;}
</style>
<ul class="nav nav-tabs" id="myTab">
	<li class="active">
		<a href="#">分类列表</a>
	</li>
</ul>
<div class="app-content">
	<div class="app-filter">
		<div class="filter-action">
			<a href="{php echo web_url('pocket/Type/operating')}" class="btn btn-primary">添加一级分类</a>
			<a href="javascript:;" class="btn btn-default js-category-all js-collapse">折叠分类</a>
		</div>
	</div>
	<div class="app-table-list">
		<div class="main panel panel-default">
			<div class="table-responsive">
				<table class="table table-hover">
					<thead>
					<tr>
						<th width="10%">分类图片</th>
						<th width="20%">分类名称</th>
						<th width="10%" class="text-center">标签种类</th>
						<th width="10%" class="text-center">付费发帖</th>
						<th width="10%" class="text-center">分类ID</th>
						<th width="10%" class="text-center">开启状态</th>
						<th width="10%" class="text-center">显示顺序</th>
						<th width="30%" class="text-center">操作</th>
					</tr>
					</thead>
					<tbody >
					{loop $list $item}
					<tr class="text-center">
						<td >
							<img class="scrollLoading" src="{php echo tomedia($item['img'])}"  height="45" width="45" style='float:left;'/>
						</td>
						<td class="text-left">
							<div>
								<span style="overflow: hidden; display:block;width:100px;text-align:left;float:left;margin-right:10px;text-overflow: ellipsis;white-space: nowrap;color: {$item['color']};">{$item['title']}</span>
							</div>
							<div class="{if $item['isnav'] ==1}hide{/if}">
								<span style='display:block;width:100px;text-align:left;float:left;'>
									<a href="{php echo web_url('pocket/Type/operating',array('parentid'=>$item['id']))}" class="add add_level1" title="添加子分类" >
										<i class="fa fa-plus-circle"></i>添加子分类
									</a>
								</span>
								<span class="category-caret">
									<i class="fa fa-caret-down js-category-down" style="display:none;" pid="{$item['id']}"></i>
									<i class="fa fa-caret-up js-category-up" pid="{$item['id']}"></i>
								</span>
							</div>
						</td>
						<td>
							{if $item['isnav'] ==1}
								<label class='label label-primary'>导航标签</label>
							{else}
								<label class='label label-danger'>普通分类</label>
							{/if}
						</td>
						<td>
							<a href="javascript:;" data-toggle="ajaxEdit" data-href="{php echo web_url('pocket/Type/setPrice',array('id'=>$item['id']))}" style="color: #000;">{$item['price']}</a>
						</td>
						<td>
							<label class='label label-warning'>{$item['id']}</label>
						</td>
						<td>{php echo tpl_change_status('pocket/Type/changeStatus&id='.$item['id'],$item['status'])}</td>
						<td class="text-center">{$item['sort']}</td>
						<td class="text-center" style="position: relative">
							{if $item['isnav'] != 1}
<!--							'title'=>$item['title']-->
								<a href="javascript:;" data-id="{$category['id']}"  data-url="{php echo h5_url('pagesA/econdaryClassification/econdaryClassification',['id'=>$item['id']])}&title={$item['title']}"  class="js-clip" >
									复制链接
								</a>
								-
								<a href="javascript:;" data-id="{$category['id']}"  data-url="pagesA/econdaryClassification/econdaryClassification?id={$item['id']}&title={$item['httitle']}"  class="js-clip" >
									复制路径
								</a>
								-
							{/if}
							<a href="{php echo web_url('pocket/Type/operating',array('id'=>$item['id']))}">编辑 </a>
							-
							<a href="{php echo web_url('pocket/Type/operating',array('did'=>$item['id']))}">删除 </a>
						</td>
					</tr>

					{loop $item['children'] $iitem}
					<tr class="js-collpase js-child-category text-center" pid="{$item['id']}" >
						<td><img class="scrollLoading" src="{php echo tomedia($iitem['img'])}" width='45' height="45" style='float:right;'/></td>
						<td class="text-left">
							<div style="padding-left:50px;height:30px;line-height:30px;background:url('./resource/images/bg_repno.gif') no-repeat -245px -545px;width: 200px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;color: {$iitem['color']};">
								{$iitem['title']}
							</div>
						</td>
						<td>
							{if $iitem['isnav'] ==1}
								<label class='label label-primary'>导航标签</label>
							{else}
								<label class='label label-danger'>普通分类</label>
							{/if}
						</td>
						<td>
							<a href="javascript:;" data-toggle="ajaxEdit" data-href="{php echo web_url('pocket/Type/setPrice',array('id'=>$iitem['id']))}" style="color: #000;">{$iitem['price']}</a>
						</td>
						<td>
							<label class='label label-default'>{$iitem['id']}</label>
						</td>
						<td>{php echo tpl_change_status('pocket/Type/changeStatus&id='.$iitem['id'],$iitem['status'])}</td>
						<td class="text-center">{$iitem['sort']}</td>
						<td class="text-center" style="position: relative">
							{if $iitem['isnav'] != 1}
								<a href="javascript:;" data-id="{$category['id']}"  data-url="{php echo h5_url('pagesA/econdaryClassification/econdaryClassification',['id'=>$item['id'],'two_id'=>$iitem['id']])}&title={$iitem['title']}" class="js-clip" >
									复制链接
								</a>
								-
								<a href="javascript:;" data-id="{$category['id']}"  data-url="pagesA/econdaryClassification/econdaryClassification?id={$item['id']}&two_id={$iitem['id']}&title={$iitem['httitle']}"  class="js-clip" >
									复制路径
								</a>
								-
							{/if}
							<a href="{php echo web_url('pocket/Type/operating',array('id'=>$iitem['id']))}">编辑 </a>
							-
							<a href="{php echo web_url('pocket/Type/operating',array('did'=>$iitem['id']))}">删除 </a>
						</td>
					</tr>
					{/loop}
					{/loop}
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	//控制显示
	$(function(){
		$('.js-category-all').click(function() {
			if($(this).hasClass('js-collapse')) {
				$('.js-child-category').fadeOut("slow");
				$('.fa-caret-up').hide();
				$('.fa-caret-down').show();
				$(this).text('全部展开').removeClass('js-collapse');
				
			} else {
				
				$('.js-child-category').fadeIn("slow");
				$('.fa-caret-up').show();
				$('.fa-caret-down').hide();
				$(this).text('全部折叠').addClass('js-collapse');
			}
		});
		$('.js-category-up').click(function() {
			var parentId = $(this).attr('pid');
			$('tr[pid="'+parentId+'"]').fadeOut("slow");
			$(this).prev().show();
			$(this).hide();
		});
		$('.js-category-down').click(function() {
			var parentId = $(this).attr('pid');
			$('tr[pid="'+parentId+'"]').fadeIn("slow");
			$(this).next().show();
			$(this).hide();
		});
	});
</script>
{php include wl_template('common/footer');}